<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>Document</title>
    <link rel="stylesheet" href="../../../lib/reset.css/reset.css">
    <style>
        canvas{
            border: 1px solid black;
            margin: 0 auto;
            display: block;
        }

    </style>
</head>

<body>
    <canvas id="myCanvas" width="400px" height="500px">
        您的浏览器不支持canvas请更新浏览器！！
    </canvas>
    <script>
        var myCanvas = document.querySelector('#myCanvas');
        var paint = myCanvas.getContext('2d'); 

        paint.fillStyle = 'red';
        paint.fillRect(100,100,100,100);
        
        paint.rect(0,200,200,100);
        paint.fillStyle = 'blue';
        paint.fill();
        
        paint.strokeStyle = 'blue';
        paint.strokeRect(0,0,100,100);

        paint.lineWidth = 20;
        paint.strokeStyle = 'yellow';
        paint.strokeRect(300,300,100,100); 

        paint.beginPath();
       paint.lineWidth = 1;
        paint.strokeStyle = 'blue';
        paint.rect(200,200,100,100);
        paint.stroke();
        paint.clearRect(0,200,200,50); 





    </script>
</body>

</html>